package com.cci.kangdao.dao;

import com.cci.kangdao.dao.model.WorkOrderOverTime;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface WorkOrderOverTimeDao {
    int deleteByPrimaryKey(Long id);

    int insert(WorkOrderOverTime record);

    int insertSelective(WorkOrderOverTime record);

    WorkOrderOverTime selectByPrimaryKey(Long id);

    @Select("select * from WorkOrderOverTime_T where OrderId = #{orderId} and OrderStatus = #{orderStatus}")
    WorkOrderOverTime selectByOrderInfo(@Param("orderId")  Long orderId,@Param("orderStatus") Integer orderStatus);

    @Select("select ReasonMessage from WorkOrderReason_T where Flag = 0 and ReasonKey = #{reasonKey}")
    String getReasonMessageByReasonKey(@Param("reasonKey") Integer reasonKey);

    int updateByPrimaryKeySelective(WorkOrderOverTime record);

    int updateByPrimaryKey(WorkOrderOverTime record);
    
    @Select("select top 1 * from WorkOrderOverTime_T where OrderId = #{workOrderId} and type = #{overTimeType} order by id desc")
    WorkOrderOverTime getOverTimeReasonByOrderIdAndType(@Param("workOrderId")long workOrderId, @Param("overTimeType")Integer overTimeType);
}